class B {
    public int Func() {
        System.out.print("B");
        return 0;
    }
}
class D extends B {
    @Override
    public int Func() {
        System.out.print("D");
        return 0;
    }
}
public class Test {
    public static void main(String[] args) {
        B a = new B();
        B b = new D();
        a.Func();
        b.Func();
    }
}

class Solution {
    public void shiftDown(int[] arr, int parent, int len){
        int child = parent * 2 + 1;
        while (child < len){
            if (child + 1 < len && arr[child] < arr[child + 1]){
                child++;
            }

            if (arr[parent] < arr[child]){
                int t = arr[parent];
                arr[parent] = arr[child];
                arr[child] = t;
                parent = child;
                child = parent * 2 + 1;
            } else {
                break;
            }
        }
    }

    public void creatMaxHeap(int[] arr, int len){
        int root = (arr.length - 2) / 2;
        for (; root >= 0; root--){
            shiftDown(arr,root,len);
        }
    }

    public void deleteRoot(int[] arr, int len){
        int t = arr[0];
        arr[0] = arr[len - 1];
        arr[len - 1] = t;
        len--;
        shiftDown(arr,0,len);
    }

    public void addRoot(int[] arr, int val, int len){
        arr[len] = val;
        shiftUp(arr,len);
    }

    public void shiftUp(int[] arr, int child){
        int parent = (child - 1) / 2;
        while (parent >= 0){
            if (arr[parent] < arr[child]){
                int t = arr[parent];
                arr[parent] = arr[child];
                arr[child] = t;
                child = parent;
                parent = (child - 1) / 2;
            } else {
                break;
            }
        }
    }

    public int lastStoneWeight(int[] stones) {
        int len = stones.length;
        creatMaxHeap(stones,len);
        while (len > 1){
            int first = stones[0];
            deleteRoot(stones,len--);
            int next = stones[0];
            deleteRoot(stones,len--);
            if (first != next){
                int addVal = first > next ? first - next : next - first;
                addRoot(stones,addVal,len++);
            }
        }
        return len == 1 ? stones[0] : 0;
    }
}

class RecentCounter {
    Queue<Integer> queue;
    public RecentCounter() {
        queue = new ArrayDeque<Integer>();
    }

    public int ping(int t) {
        queue.offer(t);
        int first = queue.peek();
        while (t - first > 3000){
            queue.poll();
            first = queue.peek();
        }
        return queue.size();
    }
}